<template>
  <view class="RecordDetail">
      <uni-list>
        <uni-list-item
          :title="item.name"
          :note="item.username"
          v-for="item in stuList"
          :key="item.id"
        >
          <template #footer>
           <button size="mini" @click="clickHandler(item.id)" type="primary" style="height:60rpx;line-height:60rpx">登记详情</button>
          </template>
        </uni-list-item>
      </uni-list>

  </view>

</template>

<script  setup>
import { getStuListByCourseId } from "@/api/teacherApi"
import { onLoad } from "@dcloudio/uni-app"

  const clickHandler=(id)=>{
    uni.navigateTo({
      url:`/pages/StuRecordDetail/StuRecordDetail?stuId=${id}&rId=${prop.id}`,
    })
  }
  const prop=defineProps(["id","courseId"])
  const stuList=ref([])
  const getStuList=()=>{
    getStuListByCourseId({id:prop.courseId}).then(res=>{
      stuList.value=res.data||[]
    })
  }
  onLoad(()=>{
    getStuList()
  })
</script>

<style lang="scss" scoped>

</style>